<?php
unset($_SESSION['chapts']);
unset($_SESSION['tap']);
unset($_SESSION['chapt']);
unset($_SESSION['last_chapt']);
$model = new Model();
$model->select = "id, name";
$model->where = "";
$model->order = "name ASC";
$model->getdata('category');
$data['categories'] = $model->fetchAll();

$model->select = 'count(id) as totalTruyen';
$model->where = "getlink_manual = 0";
$model->order = "";
$model->getdata('truyen');

$resultTotalTruyen = $model->fetchOne();

$data['total_truyen'] = $resultTotalTruyen['totalTruyen'];

$model->select = '*';
$model->where = "getlink_manual = 0";
$model->order = "id ASC";
$model->limit = LIMIT_GET_STORY;
$model->getdata('truyen');


$data['limit_stories'] = $model->num_rows();
$data['stories'] = $model->fetchAll();


loadview('template/header',$data);
loadview('user/update_story_source',$data);